package com.mlog.njyjy.ndop.msg.common.domain;

import com.jfinal.plugin.activerecord.Model;
import com.mlog.njyjy.ndop.msg.common.domain.core.Timeable;
import com.mlog.njyjy.ndop.msg.common.support.Constants;
import com.mlog.njyjy.ndop.share.sql.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * <p>
 * 流程节点表
 * </p>
 *
 * @author zyz
 * @version v1.0, 2020/8/12
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@Table(prefix = Constants.TBL_MSG_PREFIX,
        uniques = {@TableUnique(columns = {"flowId", "sequence"})},
        comment = "流程节点表")
public class NodeItem extends Model<NodeItem> implements Timeable {

    @Id
    private Long id;

    @Column(nullable = false, comment = "业务类型名")
    private String typeName;

    @Column(nullable = false, comment = "消息来源系统名")
    private String sourceName;

    @Column(nullable = false, comment = "流程id")
    private Long flowId;

    @Column(nullable = false, comment = "节点在流程中的顺序")
    private int sequence;

    @Column(updatable = false)
    private LocalDateTime createAt;

    private LocalDateTime updateAt;

    @Join(joinedBy = "flowId", mappedBy = "id")
    private Flow flow;

}
